<template>
    <div>
        <div class="margin-top1">
            <el-button type="primary" size="small" @click="readAll">全部标记为已读</el-button>
        </div>
    </div>
</template>

<script>
import { allReadSystemMessage } from "@/api/news"
import Cookies from 'js-cookie'//获取cookies的信息

export default {
    methods:{
       readAll(){
        this.$confirm('已读全部消息内容, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
                allReadSystemMessage(Cookies.get('admin_id')).then(res => {
                    if(res.code==200){
                        this.$message.success(res.message)
                        this.$bus.$emit("readAllfn","")
                    }else{
                        this.$message.warning(res.message)
                    }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消操作'
                });
            });
        
       } 
    }
}
</script>

<style></style>